/*
 * SemanticAnalisys.h
 *
 *  Created on: 18/05/2010
 *      Author: rodolfo
 */

#ifndef SEMANTICANALISYS_H_
#define SEMANTICANALISYS_H_
#include "parser/CompoundStatement.h"
#include "parser/Expression.h"
#include "parser/Statement.h"
#include "parser/CastExpression.h"
#include "parser/CompoundStatement.h"
#include "parser/Declaration.h"
#include "parser/Do.h"
#include "parser/Else.h"
#include "parser/ExpressionStatement.h"
#include "parser/For.h"
#include "parser/Identifier.h"
#include "parser/If.h"
#include "parser/IterationStatement.h"
#include "parser/SelectionStatement.h"
#include "parser/UnaryExpression.h"
#include "parser/BinaryExpression.h"
#include "parser/While.h"
#include <map>
#include <iostream>

class SemanticAnalisys
{
    const std::string& expressionAnalisys ( Expression *expression );
    void statementAnalisys ( Statement *statement );
    void castExpressionAnalisys ( CastExpression *castExpression );
    void compoundStatementAnalisys ( CompoundStatement *compoundStatement );
    void declarationAnalisys ( Declaration *declaration );
    void doStatementAnalisys ( Do *doStatement );
    void elseStatementAnalisys ( Else *elseStatement );
    std::string expressionStatementAnalisys ( ExpressionStatement *expressionStatement );
    void forStatementAnalisys ( For *forStatement );
    void identifierAnalisys ( Identifier *identifier );
    void ifStatementAnalisys ( If *ifStatement );
    void iterationStatementAnalisys ( IterationStatement *iterationStatement );
    void selectionStatementAnalisys ( SelectionStatement *selectionStatement );
    void unaryExpressionAnalisys ( UnaryExpression *unaryExpression );
    void binaryExpressionAnalisys ( BinaryExpression *binaryExpression );
    void whileStatementAnalisys ( While *whileStatement );
    void appendSymbolTable ( Declarations *declarationList );
    void charAnalisys ( Identifier *identifier );
    void shortAnalisys ( Identifier *identifier );
    void intAnalisys ( Identifier *identifier );
    void longAnalisys ( Identifier *identifier );
    void floatAnalisys ( Identifier *identifier );
    void doubleAnalisys ( Identifier *identifier );
    void assigmentAnalyse ( BinaryExpression *binaryExpression );
    void error ( std::string );
    bool find ( std::string& );
public:
    std::map<std::string, Identifier> symbolTable;
    std::pair<std::string, Identifier> *identPair;
    SemanticAnalisys();
    SemanticAnalisys ( CompoundStatement *program );
    virtual ~SemanticAnalisys();
};

#endif /* SEMANTICANALISYS_H_ */
